#ifndef __PIG_H__
#define __PIG_H__

#include "Sprite.h"

#define  PIG_BEATEN		0x00000010
#define  PIG_EATING		0x00000020
#define  PIG_RECOVERING 0x00000040


class Pig : public Sprite
{
public:
	Pig(Ogre::SceneManager * _sm , Ogre::Camera * _c)
		:Sprite(_sm, _c)
	{
		//for moving
		mLinearSpeed = 2.5;

		//for predation
		predatorDistance2 = 1.f;//x2+y2+z2

		//for beaten
		BEATEN_PERIOD = 2.0f;

		//for recovering
		recoveringP = Ogre::Quaternion::IDENTITY;
		recoveringQ = Ogre::Quaternion::IDENTITY;
		recoveringProgress = 0.0f;
		recoveringFactor = 1.0f / 64.0f; //64 is framerate, recovered in 1 seconds.
	}

	
	virtual void spriteMove(int, int );
	virtual void animationChanging(Ogre::Real timeSinceLast);
	virtual void update(Ogre::Real timeSinceLast);

	virtual void setFXVolumn();

	//game logic relative
	Ogre::Real predatorDistance2;
	Ogre::Real beatenPeriod;
	Ogre::Real BEATEN_PERIOD; // ref value

	Ogre::Quaternion recoveringP;
	Ogre::Quaternion recoveringQ;
	Ogre::Real recoveringProgress;
	Ogre::Real recoveringFactor;

	void beaten(Ogre::Vector3 ImpluseFrom);
};


#endif